﻿using UnityEngine;
using TinyWnd;

public class TopbarWnd : Wnd
{
    protected override void OnAwake()
    {
        _wndId = WndId.topbar;
        _wndType = WndType.toolbar;

        var tran = transform;
        var goBtnReturn = tran.Find("BtnReturn").gameObject;
        var goBtnShop = tran.Find("TopRight/01BtnShop").gameObject;
        var goBtnMsg = tran.Find("TopRight/02BtnMsg").gameObject;

        var inst = WndMgr.inst;
        UIEventListener.Get(goBtnReturn).onClick = delegate
        {
            inst.PopWindow();
        };

        UIEventListener.Get(goBtnShop).onClick = delegate
        {
            inst.ShowWindow(WndId.shop);
        };

        UIEventListener.Get(goBtnMsg).onClick = delegate
        {
            var content = new MsgBoxContent();
            content.boxType = MsgBoxType.ok;
            content.text = "I like pink msgbox\nI wish you like too";
            inst.ShowWindow(WndId.msgBox, content);
        };
    }
}
